package com.zhiyou100.crm.service.impl;

import com.zhiyou100.crm.dao.NoticeDao;
import com.zhiyou100.crm.service.NoticeService;
import com.zhiyou100.crm.pojo.Notice;
import com.zhiyou100.crm.pojo.User;
import com.zhiyou100.crm.util.S_session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("noticeServiceImpl")
public class NoticeServiceImpl implements NoticeService {
//    private NoticeDao noticeDao=new NoticeDaoImpl();
    @Autowired
    private NoticeDao noticeDao;
    @Override
    public List<Notice> queryAllNotice() throws Exception {
        List<Notice> notices =noticeDao.queryAllNotice();
        return notices;
    }

    @Override
    public Boolean removeById(int noticeId) throws Exception {
        Boolean a = noticeDao.removeById(noticeId);
        if(a){return true;}else {return false;}
    }
    @Override
    public Notice queryNoticeById(int notice_id) throws Exception {
        Notice notice = noticeDao.queryNoticeById(notice_id);
        return notice;
    }

    @Override
    public List<Notice> queryNoticeByFile(Notice notice) throws Exception {
        List<Notice> notices =noticeDao.queryNoticeByFile(notice);
        return notices;
    }

    @Override
    public int addNotice(Notice notice) throws Exception {
        int a = noticeDao.addNotice(notice);
        return a;
    }

    @Override
    public int upadteNotice(Notice notice) throws Exception {
        int a = noticeDao.upadteNotice(notice);
        return a;
    }
}
